<%@ page language="java" import="com.bjsxt.shopping.product.*"
	pageEncoding="utf-8"%>
<%@ page import="java.util.*"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/"; 
%>

<%
     request.setCharacterEncoding("utf-8");
    
	final int PAGE_SIZE = 8;
	int pageNo = 1;
	
	String strPageNo = request.getParameter("curPageNo");
	System.out.println("ppp---"+strPageNo);
	if (strPageNo != null && !strPageNo.trim().equals("")) {
		try {
	pageNo = Integer.parseInt(strPageNo);
		} catch (NumberFormatException e) {
	pageNo = 1;
		}
	}
	if (pageNo <= 0)
		pageNo = 1;
	// int categoryId = Integer.parseInt(request.getParameter("categoryId"));
	
	String status=request.getParameter("send_status");
	if(null==status){
		status="";
	}
	
	List<Product> products = new ArrayList<Product>();
	int totalRecords = ProductMgr.getInstance().findWebpageOrderList(products, pageNo,
	PAGE_SIZE, status);

	int totalPages = (totalRecords + PAGE_SIZE - 1) / PAGE_SIZE;

	if (pageNo > totalPages)
		pageNo = totalPages;
		
%>

 <!DOCTYPE html>
<html>
	<head>
 		<meta name="viewport" content="width=device-width, initial-scale=1">
        <title>--订单状态跟踪</title>
        <link rel="stylesheet" href="<%=basePath%>Plug/jquery.mobile-1.2.0/jquery.mobile-1.2.0.min.css" />
        <link rel="stylesheet" href="<%=basePath%>Plug/jquery.mobile-1.2.0/demos/docs/_assets/css/jqm-docs.css" />
        <script src="<%=basePath%>Plug/jquery.mobile-1.2.0/jquery-1.8.3.min.js">
        </script>
        <script src="<%=basePath%>Plug/jquery.mobile-1.2.0/jquery.mobile-1.2.0.min.js">
        </script>
        <script src="<%=basePath%>Plug/chart/ichart-1.0.min.js">
        </script>
        <script src="<%=basePath%>Plug/message.js">
        </script>
        <link rel="stylesheet" href="<%=basePath%>css/TobaccoMobileView.css" />

		<link href="images/new.css" rel="stylesheet" type="text/css">
		<script language="javascript1.2">
function js_callpage(htmlurl)
{
	var newwin=window.open(htmlurl,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=2,width=360,height=470');
	return false;
}
function js_callpage1(htmlurl)
{
	var newwin=window.open(htmlurl,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=2,width=100,height=100');
	return false;
}


function to_page(forword)
{
	if(forword=="1"){
		register.curPageNo.value=1;
	}

	if(forword=="pre"){
		var curPageId = parseInt(document.getElementById("curPageNo").value);
		curPageId=curPageId-1;
		
		if(curPageId>=1){
			register.curPageNo.value=curPageId;
		}else{
			alert('已是第一页了！');	
			return ;
		}		
	}
	
	if(forword=="next"){
		var curPageId = parseInt(document.getElementById("curPageNo").value);
		curPageId=curPageId+1;
		
		var allPages = parseInt(document.getElementById("allPages").value);
		if(curPageId<=allPages){
			register.curPageNo.value=curPageId;
		}else{
			alert('已是最后一页了！');	
			return ;
		}
	}
}
</script>

	</head>
	<body>
        <div data-role="page" class="type-interior" id="januarySales">
            <div data-role="header" data-theme="f">
                <h1>订单状态跟踪</h1>
                <a rel="external"  href="" data-icon="home" data-iconpos="notext">Home</a>
                <a rel="external"  href="<%=basePath%>UserLoginMobile.jsp" data-value="退出" >退出</a>
            </div>	
	   <form  method="post" name="register"  action="" onSubmit="this.submit.disabled=true;">	
		<table align="center" border="0" cellpadding="0" cellspacing="0"
			>
			<tbody>


				<tr>
					<td bgcolor="#dadce8" height="1">
						<img src="images/line.gif" height="1" width="1">
					</td>
				</tr>

				<tr>
					<td>
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody>
								<tr>
									<td valign="top" width="780">
										<table style="border-collapse: collapse;" border="0"
											bordercolor="#111111" cellpadding="0" cellspacing="0"
											height="417" width="100%">
											<tbody>


												<tr>
													<td height="119">
														<table style="border-collapse: collapse;" border="0"
															cellpadding="0" cellspacing="0"
															width="100%">
															<tbody>
																<tr>
																	<td width="100%">
																		<input name="nowpcd" value="" type="hidden">
																		<table border="1"  bordercolor="#2BD5D5" cellpadding="2" cellspacing="0"
																			width="100%">



																				<tr>
																					<td height="25" colspan="8" bgcolor="#e5e5f0">
																						<table style="border-collapse: collapse;"
																							border="0"  cellpadding="0" cellspacing="0"
																							width="100%">
																							<tbody>
																								<br>
																								<tr>
																									<td align="right">
																										<font  size="2" color="blue">&nbsp;&nbsp;&nbsp;&nbsp; 
																										&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;  管理员1， 欢迎您！   </font>
																										
																										
																											
																									</td>
																								</tr>
																								<tr>
																									<td>
																										&nbsp;
																										<img src="images/m_33.gif" height="10"
																											width="10">
																										&nbsp;
																										<strong><a
																											href="">订单状态跟踪</a>
																										</strong> &nbsp;
																									</td>
																								</tr>
																								
																								<tr>
																									<td align="right">
																								 	订单状态: <select name="send_status"  style=""> 
																								 				 <% 
																								 				 System.out.println("haha:--"+status);
																								 				 if(status.equals("")){%> 
	                                                                                                               <option value="" selected = "selected">请选择订单状态</option> 
	                                                                                                             <%}else{ %>
	                                                                                                             	<option value="" >请选择订单状态</option> 
	                                                                                                             <%} %>
	                                                                                                             
																								 				 <% if(status.equals("待抢单")){%> 
	                                                                                                               <option value="待抢单" selected = "selected">待抢单</option> 
	                                                                                                             <%}else{ %>
	                                                                                                             	<option value="待抢单">待抢单</option> 
	                                                                                                             <%} %>	                                                                                                             
                                                                                                                 
                                                                                                                 <% if(status.equals("翻译中")){%> 
	                                                                                                               <option value="翻译中" selected = "selected">翻译中</option> 
	                                                                                                             <%}else{ %>
	                                                                                                             	<option value="翻译中">翻译中</option> 
	                                                                                                             <%} %>	 
	                                                                                                             
	                                                                                                             <% if(status.equals("待审核")){%> 
	                                                                                                               <option value="待审核" selected = "selected">待审核</option> 
	                                                                                                             <%}else{ %>
	                                                                                                             	<option value="待审核">待审核</option> 
	                                                                                                             <%} %>
	                                                                                                             
	                                                                                                             <% if(status.equals("客户已付款")){%> 
	                                                                                                               <option value="客户已付款" selected = "selected">客户已付款</option> 
	                                                                                                             <%}else{ %>
	                                                                                                             	<option value="客户已付款">客户已付款</option> 
	                                                                                                             <%} %>
	                                                                                                             
                                                                                                           </select> 
																									
																										<input type="submit" value="查询" onclick="to_page('1')"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																										
																									</td>
																								</tr>																								
																								
																								<tr>																									

																									<td align="left">
																										全部
																										<b><%=totalRecords%> </b>条订单,共
																										<b><%=totalPages%> </b>页,当前第
																										<b><%=pageNo%> </b>页&nbsp;&nbsp;
																										<input type="submit" value="上一页" onclick="to_page('pre')" />
																										<input type="submit" value="下一页" onclick="to_page('next')"/>
																										<input id="curPageNo" name="curPageNo" value=<%=pageNo%> type="hidden">
																										<input id="allPages" name="allPages" value=<%=totalPages%> type="hidden">
																									</td>
																								</tr>

																							</tbody>
																						</table>
																					</td>
																				</tr>

																				<tr>
																					<td width="13%" align="center">订单编号</td>
																					<td width="13%" align="center">订单类型</td>
																					<td width="23%" align="center">订单标题</td>
																					<td width="9%" align="center">订单字数</td>
																					<td width="9%" align="center">订单价格</td>
																					<td width="13%" align="center">订单发布时间</td>
																					<td width="9%" align="center">订单状态</td>
																					<td width="10%" align="center">操作</td>
																				
																				</tr>
																				
																				<%
																						if( products.size()==0) {
																				%>
																				<tr>
																					<td align="center" colspan="5">没有该条件的订单！</td>
																				
																				</tr>
																				<%
																						}
																				%>																				


																				<%
																						for (int i = 0; i < products.size(); i++) {
																						Product p = products.get(i);
																				%>																			

																				
																				<tr>
																				 	<td align="center"><%=p.getId()%></td>
																				 	<td><%=p.getArticle()  %></td>
																				 	<td><%=p.getSubject()%></td>
																				 	<td><%=p.getWordsNum()%></td>
																				 	<td><%=p.getPrice()%></td>
																				 	<td><%=p.getSave_time()  %></td>
																				 	<td><%=p.getSend_status()  %></td>
																				 	
																				 	<td>
																				 	<%
																						if( p.getSend_status().equals("客户已付款") ) {
																					%>
																				 	<a href=""><font style="font-weight:bold;color:blue;TEXT-DECORATION: underline; ">给译者报酬</font></a> 
																				 	<%
																						}
																					%>	
																				 	</td>
																				 
																				</tr>
																				
																				<%
																				} // end for
																				%>	

																		</table>
																	</td>
																</tr>

															</tbody>
														</table>
													</td>
												</tr>
												<tr>
													<td height="30">
													</td>
												</tr>
											</tbody>
										</table>
									</td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>
				<tr>
					<td width="100%">
						<!--底部INC--><br>
					</td>
				</tr>
			</tbody>
		</table>
	  </form>
    </div>
  </body>
</html>
